home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 April / macformat-023.iso / Shareware in MacFormat / brailler0.5b / brlr ƒ / Shell ƒ / file interface.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-12-20  |  1.3 KB  |  49 lines  |  [TEXT/MMCC]

  1. #include "file interface.h"
  2. #include "program globals.h"
  3. #include "window layer.h"
  4.  
  5. Boolean GetSourceFile(FSSpec *sourceFS)
  6. /* a standard procedure which shows an open dialog box and returns the FSSpec of
  7.    the file you selected (or returns FALSE if you cancelled) */
  8. {
  9.     StandardFileReply    reply;
  10.     SFTypeList            theTypes;
  11.     
  12.     RemoveHilitePatch();
  13.     
  14.     theTypes[0]=SAVE_TYPE;
  15.     StandardGetFile(0L, 1, theTypes, &reply);    /* reply's got an FSSpec in it afterwards */
  16.  
  17.     if (reply.sfGood)
  18.         FSMakeFSSpec(reply.sfFile.vRefNum, reply.sfFile.parID, reply.sfFile.name,
  19.                             sourceFS);
  20.         
  21.     InstallHilitePatch();
  22.     
  23.     return reply.sfGood;    /* TRUE if we have a valid file selected */
  24. }
  25.  
  26. Boolean GetDestFile(FSSpec *destFS, Boolean *deleteTheThing, Str255 theTitle)
  27. /* a standard save dialog box -- given a title (for the prompt), it returns the
  28.    file's FSSpec in destFS and whether a file of that name already exists in
  29.    deleteTheThing (TRUE if file already exists) */
  30. /* details are pretty much the same as GetSourceFile(), see above */
  31. {
  32.     StandardFileReply    reply;
  33.     
  34.     RemoveHilitePatch();
  35.     
  36.     StandardPutFile(theTitle, destFS->name, &reply);
  37.  
  38.     if (reply.sfGood)
  39.     {
  40.         *deleteTheThing=reply.sfReplacing;    
  41.         FSMakeFSSpec(reply.sfFile.vRefNum, reply.sfFile.parID, reply.sfFile.name,
  42.                         destFS);
  43.     }
  44.     
  45.     InstallHilitePatch();
  46.     
  47.     return reply.sfGood;
  48. }
  49.